import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class AppBarDemoPage extends StatefulWidget {
  const AppBarDemoPage({Key? key}) : super(key: key);

  @override
  _AppBarDemoPageState createState() => _AppBarDemoPageState();
}

class _AppBarDemoPageState extends State<AppBarDemoPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(
                  child: Text("热门"),
                ),
                Tab(
                  child: Text("推荐"),
                ),
                Tab(
                  child: Text("我的"),
                ),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              ListView(
                children: [
                  ListTile(
                    title: Text("热门中第一个title"),
                  ),
                  ListTile(
                    title: Text("热门中第二个title"),
                  ),
                  ListTile(
                    title: Text("热门中第三个title"),
                  ),
                  ListTile(
                    title: Text("热门中第四个title"),
                  ),
                ],
              ),
              ListView(
                children: [
                  ListTile(
                    title: Text("推荐中第一个title"),
                  ),
                  ListTile(
                    title: Text("推荐中第二个title"),
                  ),
                  ListTile(
                    title: Text("推荐中第三个title"),
                  ),
                  ListTile(
                    title: Text("推荐中第四个title"),
                  ),
                ],
              ),
              ListView(
                children: [
                  ListTile(
                    title: Text("我的中第一个title"),
                  ),
                  ListTile(
                    title: Text("我的中第二个title"),
                  ),
                  ListTile(
                    title: Text("我的中第三个title"),
                  ),
                  ListTile(
                    title: Text("我的中第四个title"),
                  ),
                ],
              ),
            ],
          ),
        ));
  }
}

/*

class _AppBarDemoPageState extends State<AppBarDemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: Colors.red,
        leading: IconButton(
          onPressed: () {
            print('menu-----------》');
          },
          icon: Icon(Icons.menu),
        ),
        actions: [
          IconButton(
            onPressed: () {
              print('search-----------》');
            },
            icon: Icon(Icons.search),
          ),
          Text("设置")
        ],
        title: Text("我是标题"),
      ),
      body: Text("1"),
    );
  }
}
*/
